package org.cfg;

import com.sojoys.artifact.build.data.base.BaseCfg;
import com.sojoys.artifact.tools.ToolMap;
import com.sojoys.artifact.tools.ToolCopy;
import com.sojoys.artifact.factory.bytebuff.IByteBuff;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.sojoys.artifact.constant.DataModelKeyEnum;
/**
 * 预约约会
 */
public class DatingReserveCfg extends BaseCfg<DatingReserveCfg> {

	/**
	 * 数据库表名称
	 */
	public static final String TABLE_NAME = "dating_reserve";
	/**
	 * 完整类名称
	 */
	public static final String CLASS_NAME = "org.cfg.DatingReserveCfg"; 
	/**
	 * 字段个数
	 */
	public static final int COLUMN_COUNT= 8;
	/**
	 * 数据库源字段注释
	 */
	public static final String[] SOURCE_COLUMN_REMARKS = new String[]{"","看板娘id","建筑id","邀请剧本号","约定剧本号","失败约会剧本号1","失败约会剧本号2","答复选项",};
	/**
	 * 数据库源字段名字
	 */
	public static final String[] SOURCE_COLUMN_NAMES = new String[]{"id","roleId","buildingId","inviteScriptId","reserveScriptId","failScriptId1","failScriptId2","answer",};
	/**
	 * 拼音字段名字
	 */
	public static final String[] PINGYING_COLUMN_NAMES = new String[]{"id","roleId","buildingId","inviteScriptId","reserveScriptId","failScriptId1","failScriptId2","answer",};
	/**
	 * HashCode字段名字
	 */
	public static final Integer[] HASHCODE_COLUMN_NAMES = new Integer[]{3355,-925416399,-461357329,-641053329,-1603745758,-1717239763,-1717239762,-1412808770,};
	/**
	 * 字段基本类型
	 */
	public static final String[] COLUMN_BASICTYPES = new String[]{"int","int","int","int","int","int","int","Map",};
	/**
	 * 字段引用类型
	 */
	public static final Class[] COLUMN_CLASSTYPES = new Class[]{Integer.class,Integer.class,Integer.class,Integer.class,Integer.class,Integer.class,Integer.class,Map.class,};
	
	/**
	 * id
	 */
	private int id;
	
	/**
	 * 看板娘id
	 */
	private int roleId;
	
	/**
	 * 建筑id
	 */
	private int buildingId;
	
	/**
	 * 邀请剧本号
	 */
	private int inviteScriptId;
	
	/**
	 * 约定剧本号
	 */
	private int reserveScriptId;
	
	/**
	 * 失败约会剧本号1
	 */
	private int failScriptId1;
	
	/**
	 * 失败约会剧本号2
	 */
	private int failScriptId2;
	
	/**
	 * 答复选项
	 */
	private Map answer;
	
	
	
	public static DatingReserveCfg builder() {
		DatingReserveCfg datingReserveCfg = new DatingReserveCfg();
		return datingReserveCfg;
	}
	
	/**
	 * id
	 */
	public int getId() {
		return id;
	}
	
	/**
	 * 看板娘id
	 */
	public int getRoleId() {
		return roleId;
	}
	
	/**
	 * 建筑id
	 */
	public int getBuildingId() {
		return buildingId;
	}
	
	/**
	 * 邀请剧本号
	 */
	public int getInviteScriptId() {
		return inviteScriptId;
	}
	
	/**
	 * 约定剧本号
	 */
	public int getReserveScriptId() {
		return reserveScriptId;
	}
	
	/**
	 * 失败约会剧本号1
	 */
	public int getFailScriptId1() {
		return failScriptId1;
	}
	
	/**
	 * 失败约会剧本号2
	 */
	public int getFailScriptId2() {
		return failScriptId2;
	}
	
	/**
	 * 答复选项
	 */
	public Map getAnswer() {
		return answer;
	}
	
	
	protected Object[] getColumnNames(DataModelKeyEnum e){
		switch (e) {
		case SOURCE:
			return SOURCE_COLUMN_NAMES;
		case PINGYING:
			return PINGYING_COLUMN_NAMES;
		case HASHCODE:
			return HASHCODE_COLUMN_NAMES;
		case REMARKS:
			return SOURCE_COLUMN_REMARKS;
		default:
			return PINGYING_COLUMN_NAMES;
		}
	}
	
	protected String[] getBasicTypes(){
		return COLUMN_BASICTYPES;
	}
	
	protected Class[] getClassTypes(){
		return COLUMN_CLASSTYPES;
	}
	
	protected Object[] getColumeValues(){
		Object[] values = new Object[COLUMN_COUNT];
        values[0] = this.id;
        values[1] = this.roleId;
        values[2] = this.buildingId;
        values[3] = this.inviteScriptId;
        values[4] = this.reserveScriptId;
        values[5] = this.failScriptId1;
        values[6] = this.failScriptId2;
        values[7] = this.answer;
        return values;
	}
	
	protected DatingReserveCfg createColumeValues(Object[] vals) {
		this.id = (int)vals[0];
		this.roleId = (int)vals[1];
		this.buildingId = (int)vals[2];
		this.inviteScriptId = (int)vals[3];
		this.reserveScriptId = (int)vals[4];
		this.failScriptId1 = (int)vals[5];
		this.failScriptId2 = (int)vals[6];
		this.answer = (Map)vals[7];
		return this;
	}
	
	protected Map<Object, Object> toMap(Object[] keys,Map<Object, Object> map){
        map.put(keys[0], this.id);
        map.put(keys[1], this.roleId);
        map.put(keys[2], this.buildingId);
        map.put(keys[3], this.inviteScriptId);
        map.put(keys[4], this.reserveScriptId);
        map.put(keys[5], this.failScriptId1);
        map.put(keys[6], this.failScriptId2);
        map.put(keys[7], this.answer);
        return map;
    }
    
    protected DatingReserveCfg createForMap(Object[] keys,Map map){
   		this.id = (int)map.get(keys[0]);
   		this.roleId = (int)map.get(keys[1]);
   		this.buildingId = (int)map.get(keys[2]);
   		this.inviteScriptId = (int)map.get(keys[3]);
   		this.reserveScriptId = (int)map.get(keys[4]);
   		this.failScriptId1 = (int)map.get(keys[5]);
   		this.failScriptId2 = (int)map.get(keys[6]);
   		this.answer = (Map)map.get(keys[7]);
        return this;
    }
	
	
	protected JSONObject toJSONObject(Object[] keys,JSONObject obj){
        obj.put(keys[0], this.id);
        obj.put(keys[1], this.roleId);
        obj.put(keys[2], this.buildingId);
        obj.put(keys[3], this.inviteScriptId);
        obj.put(keys[4], this.reserveScriptId);
        obj.put(keys[5], this.failScriptId1);
        obj.put(keys[6], this.failScriptId2);
        obj.put(keys[7], this.answer);
        return obj;
    }
    
    protected DatingReserveCfg createForJSONObject(Object[] keys,JSONObject obj){
	    this.id = obj.getIntValue(keys[0]);
	    this.roleId = obj.getIntValue(keys[1]);
	    this.buildingId = obj.getIntValue(keys[2]);
	    this.inviteScriptId = obj.getIntValue(keys[3]);
	    this.reserveScriptId = obj.getIntValue(keys[4]);
	    this.failScriptId1 = obj.getIntValue(keys[5]);
	    this.failScriptId2 = obj.getIntValue(keys[6]);
		this.answer = obj.getObject(keys[7],Map.class);
        return this;
    }
    
    protected void writeBytes(IByteBuff byteBuf){
	    byteBuf.writeInt(this.id);
	    byteBuf.writeInt(this.roleId);
	    byteBuf.writeInt(this.buildingId);
	    byteBuf.writeInt(this.inviteScriptId);
	    byteBuf.writeInt(this.reserveScriptId);
	    byteBuf.writeInt(this.failScriptId1);
	    byteBuf.writeInt(this.failScriptId2);
	    byteBuf.writeObject(this.answer);
    }
	
	protected DatingReserveCfg readBytes(IByteBuff byteBuf){
	    this.id = byteBuf.readInt(null);
	    this.roleId = byteBuf.readInt(null);
	    this.buildingId = byteBuf.readInt(null);
	    this.inviteScriptId = byteBuf.readInt(null);
	    this.reserveScriptId = byteBuf.readInt(null);
	    this.failScriptId1 = byteBuf.readInt(null);
	    this.failScriptId2 = byteBuf.readInt(null);
	    this.answer = (Map)byteBuf.readObject();
	    return this;
	}
	
	public DatingReserveCfg deepCopy(){
		DatingReserveCfg datingReserveCfg = null;
		try {
			datingReserveCfg = (DatingReserveCfg) super.clone();
		    datingReserveCfg.answer = ToolCopy.copyObject(this.answer);
			return datingReserveCfg;
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return datingReserveCfg;
	}
//自定义内容起始位置
//自定义内容结束位置
}
